<script lang="ts" setup>
import SingleHead from "@/components/Index/SingleHead.vue";
import Meat from "@/components/Single/Meat.vue";
import Contact from "@/components/Single/Contact.vue";
import useStatus from "@/store/status";
import { IndexShowData } from "@/api/interface";
import { CloseBold } from "@element-plus/icons-vue";
import { ref } from "vue";
//实例化store
const status = useStatus();
interface Props {
  data: IndexShowData;
}

defineProps<Props>();
//按钮点击事件
const btnClick = () => {
  //收起页面
  status.changeIndexPost();
  //移除根元素的属性，
  document.body.className = "page-article";
};

//折叠框
const activeNames = ref(["1"]);
const handleChange = (val: string[]) => {
  console.log(val);
};
</script>
<template>
  <template v-if="data">
    <div
      class="modal modal-crossfade modal-open modal-page-overlay modal-quickread"
    >
      <div class="modal-overlay-container">
        <div class="modal-overlay">
          <!--内容-->
          <div class="modal-content-container">
            <div class="modal-content">
              <article class="article-quickread">
                <!--展示内容-->
                <!--页头-->

                <SingleHead :data="data"></SingleHead>

                <!--正文-->
                <div class="pagebody component">
                  <div v-html="data.content"></div>
                </div>
                <!--文章相关信息-->
                <Meat></Meat>
                <!--媒介垂询-->
                <section class="nr-accordion">
                  <el-collapse
                    v-model="activeNames"
                    @change="handleChange"
                    class="accordion-item"
                  >
                    <el-collapse-item title="媒介垂询" name="1">
                      <div class="accordion-content">
                        <Contact></Contact>
                      </div>
                    </el-collapse-item>
                  </el-collapse>
                </section>
              </article>
            </div>
          </div>
          <!--按钮-->
          <div class="modal-close-button">
            <el-button
              :icon="CloseBold"
              color="#f5f5f7"
              size="large"
              circle
              @click="btnClick"
            >
            </el-button>
          </div>
        </div>
      </div>
    </div>
  </template>
  <template v-else>加载中</template>
</template>
<style lang="less" scoped>
//媒介垂询
.nr-accordion {
  margin-top: 16px;
}
.accordion-item {
  padding-left: 36px;
  padding-right: 36px;
  border-radius: 10px;
  background-color: #f5f5f7;
  border: none;
  > div {
    padding-top: 36px;
    padding-bottom: 36px;
    .accordion-content::before {
      content: "";
      display: block;
      width: 100%;
      height: 1px;
      background-color: #fff;
    }
    :deep(.el-collapse-item__header),
    :deep(.el-collapse-item__wrap) {
      background-color: #f5f5f7;
    }
    //标题
    :deep(.el-collapse-item__header) {
      font-size: 19px;
      line-height: 1.21053;
      font-weight: 700;
    }
    //内容

    :deep(.el-collapse-item__wrap) {
      border-bottom: none;
    }
  }
  //去除哦多余元素
  :deep(.el-collapse-item__content) {
    .presscontacts-headline {
      display: none;
    }
    .contacts-container {
      display: flex;
    }
  }
}
@media only screen and (max-width: 1068px) {
  .nr-accordion {
    margin-top: 14px;
  }
  .accordion-item {
    padding-left: 32px;
    padding-right: 32px;
    > div {
      padding-top: 32px;
      padding-bottom: 32px;
    }
  }
}

.modal {
  --modal-overlay-background: #fff;
  --modal-overlay-padding-top: 76px;
  --modal-overlay-padding-bottom: 76px;
  --modal-overlay-padding-inline: 76px;
  --modal-close-button-offset-top: 16px;
  --modal-close-button-offset-inline-start: 16px;
  --modal-close-button-size: 44px;
  --modal-close-background: #e8e8ed;
  --modal-close-background-hover: #ececf0;
  --modal-close-background-active: #dfdfe4;
  --modal-close-color: rgba(0, 0, 0, 0.56);
  --modal-close-color-hover: rgba(0, 0, 0, 0.64);
  --modal-close-border-radius: 50%;
  --modal-close-button-position: sticky;
  --modal-close-icon-size: 36px;
  --modal-close-icon-svg-size: 20px;
  background: var(--modal-scrim-background, var(--modal-overlay-background));
  position: fixed;
  z-index: -1;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: none;
  overflow: auto;
}
.modal-page-overlay {
  --modal-scrim-background: rgba(0, 0, 0, 0.48);
  --modal-overlay-margin-top: 40px;
  --modal-overlay-margin-bottom: var(--modal-overlay-margin-top);
  --modal-overlay-border-radius-top: 18px;
  --modal-overlay-border-radius-bottom: var(--modal-overlay-border-radius-top);
  --modal-overlay-width: 816.66667px;
}
.modal-crossfade {
  display: block;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s,
    z-index 0s linear 0.4s;
}
.modal-quickread {
  --modal-close-button-offset-top: 24px;
  --modal-close-button-offset-inline-start: 24px;
  --modal-overlay-border-radius-top: 16px;
  --modal-overlay-padding-top: 80px;
  --modal-overlay-padding-bottom: 80px;
  --modal-overlay-padding-inline: 0;
  --modal-overlay-margin-top: 60px;
  --modal-close-background: #f5f5f7;
  --modal-close-color: #6e6e73;
  --modal-close-icon-svg-size: 17px;
  background-color: rgba(245, 245, 247, 0.3);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.modal-open {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;

  z-index: 11000;
  /*去除高度*/
  margin-top: auto;
}
.modal {
  .modal-overlay-container {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    min-height: 100%;
  }
  .modal-overlay {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
  }
  .modal-content-container {
    background: var(--modal-overlay-background);
    order: 2;
    box-sizing: border-box;
    padding-inline-start: var(--modal-overlay-padding-inline);
    padding-inline-end: var(--modal-overlay-padding-inline);
    padding-top: var(--modal-overlay-padding-top);
    padding-bottom: var(--modal-overlay-padding-bottom);
    margin-top: calc(-1 * (44px + var(--modal-close-button-offset-top)));
  }
  .modal-content {
    display: block;
  }
}

.modal-page-overlay {
  .modal-overlay {
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    border-radius: var(--modal-overlay-border-radius-top)
      var(--modal-overlay-border-radius-top)
      var(--modal-overlay-border-radius-bottom)
      var(--modal-overlay-border-radius-bottom);
    width: var(--modal-overlay-width);
    margin-top: var(--modal-overlay-margin-top);
    margin-bottom: var(--modal-overlay-margin-bottom);
    .modal-content-container {
      border-radius: inherit;
      -webkit-mask-image: radial-gradient(white, black);
      mask-image: radial-gradient(white, black);
    }
  }
}

.modal-quickread {
  .modal-overlay {
    box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.2);
    transform: scale(0.8);
    transform-origin: bottom center;
    transition: transform 400ms ease-in-out;
  }
}
.modal-quickread.modal-open {
  .modal-overlay {
    transform: scale(1);
  }
}
//按钮

.modal-close-button {
  cursor: auto;
  position: var(--modal-close-button-position);
  order: 1;
  display: flex;
  align-self: flex-start;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  height: var(--modal-close-button-size);
  width: var(--modal-close-button-size);
  margin: 0;
  padding: 0;
  border: 0;
  margin-inline-start: var(--modal-close-button-offset-inline-start);
  margin-top: var(--modal-close-button-offset-top);
  top: var(--modal-close-button-offset-top);
}
.modal-close-button {
  cursor: pointer;
}
//内容
.article-quickread {
  margin-left: auto;
  margin-right: auto;
  width: 80%;
  .component {
    width: 100%;
  }
}
.pagebody {
  font-size: 19px;
  line-height: 1.4211;
  font-weight: 400;
  letter-spacing: 0.012em;
  font-family: "SF Pro SC", "SF Pro Display", "SF Pro Icons", "PingFang SC",
    "Helvetica Neue", "Helvetica", "Arial", sans-serif;
}

//文章
.component-content {
  :deep(p) {
    overflow-wrap: break-word;
  }
}

@media only screen and (max-width: 1068px) {
  .modal-quickread {
    --modal-overlay-padding-bottom: 60px;
  }

  .article-quickread {
    width: 83.33%;
  }
  .pagebody {
    font-size: 17px;
    line-height: 1.47059;
    font-weight: 400;
  }
}
@media only screen and (max-width: 734px) {
  .modal-quickread {
    --modal-close-button-offset-top: 20px;
    --modal-close-button-offset-inline-start: 20px;
    --modal-overlay-padding-bottom: 80px;
  }
  //去除样式
  .modal-page-overlay {
    --modal-overlay-width: 100%;
    --modal-scrim-background: var(--modal-overlay-background);
    .modal-overlay {
      flex-grow: 1;
      width: 100%;
      /*覆盖*/
      margin-left: auto;
      width: auto;
      margin-top: auto;
      margin-bottom: auto;
      .modal-content-container {
        border-radius: initial;
      }
    }
  }
  .article-quickread {
    max-width: 414px;
    width: 87.5%;
  }
}
</style>
